package com.smalls.newvideotwo.utils;

import android.content.Context;
import android.util.Log;

import com.smalls.newvideotwo.NewDTVApp;

public class ViewUtil {
    private static String TAG = Constant.baddcoolio2tag? Constant.TAGPREFIXSTR + "ViewUtil":"ViewUtil";
    public static int DipToPixels(Context context, float dip) {
        return (int) ((dip * context.getResources().getDisplayMetrics().density) + 0.5f);
    }

    public static float PixelsToDip(Context context, float Pixels) {
        if (context == null) {
            context = NewDTVApp.getApp();
        }
        if (context == null) {
            return 0.0f;
        }
        float SCALE = context.getResources().getDisplayMetrics().density;
        Log.d(TAG, "dpi=" + context.getResources().getDisplayMetrics().densityDpi);
        return Pixels / SCALE;
    }
}
